import React, { Component } from 'react';

class Child extends Component {
    constructor(props){
        super(props);
        this.state = {
            count:0
        }
    }

    componentWillMount(){
        console.log('will mount')
    }
    
    componentDidMount(){
        console.log('did mount')
    }
    
    componentWillReceiveProps(newProps){
        console.log( 'will receive props' + newProps.count)
    }
    
    shouldComponentUpdate(){
        console.log('shoule updata')
        return true
    }

    componentWillUpdate(){
        console.log('will updata')
    }

    componentDidUpdate(){
        console.log('did updata')
    }
    handleAdd = ()=>{
        this.setState({
            count : this.state.count + 1
        })
    }
    render(){
        return (
            <div>
                这里是子组件
                <p>{this.props.count}</p>
            </div>
        )
    }
}

export default Child